g = graber {
    when 'x'.size() == 1 result {
        put "name", 'zhangsan'
        put "age", 22
    } next 'nextPage', {
        //委托给不同的类处理
        find "url", ["http://1","http://2"]
    }
    when 'x'.size() == 1 result {
        put "name", 'zhangsan'
        put "age", 22
    } next 'nextPage', {
        //委托给不同的类处理
        find "url", ["http://1","http://2"]
    }
}
println g.map


def graber(closure) {
    Graber g = new Graber()
    closure.delegate = g
    closure()
    g
}

def $(cssSeletor) {

}

class Page {
    def find(closure) {

    }

}


class MongoDB {

}


class Result {
    def map
    def nextPage = 'nextPage'
    Result(map) {
        this.map = map
    }

    def put(key, value) {
        map.put(key, value)
    }
    def next(nextName, closure) {
        if(nextName.equals(nextPage)) {

        }
    }
}
class Graber {
    def map = [:]

    def when(expression) {
       this
    }
    def result(closure) {
        Result r = new Result(this.map)
        closure.delegate = r
        closure()
        r
    }
}


